package com.dynamo.transport.network.practise.channel.socket;

import com.dynamo.transport.network.practise.channel.AbstractChannel;
import com.dynamo.transport.network.practise.channel.ChannelConfig;
import com.dynamo.transport.network.practise.channel.ChannelPipeline;

import java.net.SocketAddress;

/**
 * @author duanyimiao
 * @create 2018-12-19 2:40 PM
 * @description
 **/
public abstract class AbstractSocketChannel extends AbstractChannel implements com.dynamo.transport.network.practise.channel.socket.SocketChannel {

    //NIO 中的Channe TODO 定义成public 合理吗？
    public java.nio.channels.SocketChannel channel;
    protected ChannelPipeline pipeline;
    protected SocketAddress remoteAddress;

    public AbstractSocketChannel() {

    }

    public AbstractSocketChannel(ChannelPipeline pipeline, java.nio.channels.SocketChannel channel) {
        this.pipeline = pipeline;
        this.channel = channel;
    }

    @Override
    public ChannelConfig getConfig() {
        return null;
    }

    @Override
    public ChannelPipeline getPipeline() {
        return pipeline;
    }

    @Override
    public SocketAddress getLocalAddress() {
        return null;
    }

    @Override
    public SocketAddress getRemoteAddress() {
        return remoteAddress;
    }
}
